﻿using Ah.Testudin.Engine.Events;
using Ah.Testudin.Engine.UI.Elements;
using Microsoft.Xna.Framework;

namespace Ah.Testudin.Engine.Actors.Spawning
{
    public class ActorSpawner : IActorSpawner
    {
        #region Private Member Variables

        private readonly IActorBuilderFactory _actorBuilderFactory;

        #endregion

        #region Constructors

        public ActorSpawner(IActorBuilderFactory actorBuilderFactory)
        {
            _actorBuilderFactory = actorBuilderFactory;
        }

        #endregion

        public Actor SpawnActor(
            ActorType actorType,
            Matrix transform)
        {
            IActorBuilder actorBuilder = _actorBuilderFactory.GetActorBuilder(actorType);

            Actor actor = actorBuilder.BuildActor(transform);

            return actor;
        }
    }
}
